package win.bojack.mall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import lombok.Data;
import lombok.NonNull;
import org.apache.ibatis.annotations.Update;
import org.hibernate.validator.constraints.URL;
import win.bojack.common.validation.AddGroup;
import win.bojack.common.validation.ListValue;
import win.bojack.common.validation.UpdateGroup;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author will
 * @email ooops@126.com
 * @date 2021-12-23 00:16:18
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	@Null(message = "新增时不能指定品牌ID", groups = AddGroup.class)
	@NotNull(message = "修改时必须指定品牌ID", groups = UpdateGroup.class)
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "必须指定品牌名", groups = {AddGroup.class, UpdateGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotNull(groups = AddGroup.class)
	@URL(message = "logo必须是一个合法的url地址", groups = {AddGroup.class, UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态
	 */

	@ListValue(custom = "显示状态", vals = {0, 1}, groups = UpdateGroup.class)
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotEmpty(groups = AddGroup.class)
	@Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须是一个字母", groups = {AddGroup.class, UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(groups = AddGroup.class)
	@Min(value = 0, groups = {AddGroup.class, UpdateGroup.class})
	@Max(value = 100, groups = {AddGroup.class, UpdateGroup.class})
	private Integer sort;

}
